package com.hxz.admin.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.hxz.entity.Article;
import com.hxz.entity.ArticleComment;

@Mapper
public interface AdminIndexMapper {
	
	@Select("SELECT id,title,viewnum,date,content,top,add_name,category FROM article ORDER BY date DESC LIMIT 6 ")
	List<Article> getArticleList();
	
	@Select("SELECT COUNT(DISTINCT title) FROM article")
	Integer getArticleNum();
	
	@Select("SELECT id, commentUserId, articleId, content, createTime FROM articlecomments ORDER BY createTime DESC LIMIT 5 ")
	List<ArticleComment> getCommentsList();
	
	@Select("SELECT COUNT(DISTINCT id) FROM articlecomments")
	Integer getCommentNum();
	
	@Select("SELECT id,title,viewnum,date,content,top,add_name,category FROM `article` GROUP BY category ")
	List<Article> getArticleCategories();
}
